<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<input type="hidden" value="${model.id}" name="id">
<input type="hidden" value="${model.pid}" name="pid">
<input type="hidden" value="${model.type}" name="type">
<input type="hidden" value="${model.bookid}" name="bookid">
<div class="form-horizontal">
    <div class="form-group">
        <label class="control-label col-md-2">分类名称</label>
        <div class="col-md-3">
            <input type="text" id="name" name="name" class="form-control" value="${model.name}" placeholder="请输入分类名称"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">是否启用</label>
        <div class="col-md-3">
            <label>
                <select name="status" id="status" class="form-control">
                    <option value="">请选择</option>
                    <option value="0" <c:if test="${model.status==0}"> selected="selected"</c:if>>是</option>
                    <option value="1" <c:if test="${model.status==1}"> selected="selected"</c:if>>否</option>
                </select>
            </label>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">排序</label>
        <div class="col-md-3">
            <input type="text" id="sort" name="sort" class="form-control" value="${model.sort}" placeholder="请输入分排序"/>
        </div>
    </div>
</div>
<div class="form-group">
    <div class="col-md-offset-2 col-md-2">
        <button type="submit" class="btn btn-primary">
            <i class="fa fa-floppy-o"></i> 保存
        </button>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {

        $("#form1").bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                name: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                }, sort: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        regexp:{
                            regexp:  /^[1-9]\d*$/,
                            message: '只能是正整数'
                        }
                    }
                },status: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        regexp: {
                            regexp: /^[0-1]*$/,
                            message: '必须选择其中的一个'
                        }
                    }
                }
            }
        });
    });
</script>